package in.cdacnoida.persistance;

import in.cdacnoida.contacts.entities.Address;

import java.util.List;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class DBAddressRepo implements IAddressRepo {

	private DataSource ds;

	public DBAddressRepo() {

		try {
			Context context = new InitialContext();
			try {
				ds = (DataSource) context
						.lookup("java:comp/env/jdbc/trainingdb");
			} finally {
				context.close();
			}
		} catch (NamingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	@Override
	public void createAddress(Address a) {
		// TODO Auto-generated method stub

	}

	@Override
	public Address getAddress(Long id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Address> getAddressList() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void updateAddress(Address oldAddr, Address newAddr) {
		// TODO Auto-generated method stub

	}

	@Override
	public void deleteAddress(Long id) {
		// TODO Auto-generated method stub

	}

	public void init() {

	}

}
